package com.hqd.jjvm.instructions.extend;

import com.hqd.jjvm.instructions.AbstractInstruction;
import com.hqd.jjvm.instructions.InstructionType;
import com.hqd.jjvm.rtda.JThread;
import com.hqd.jjvm.rtda.obj.JObject;

public class ExtendInstruction extends AbstractInstruction {

    public ExtendInstruction(JThread jThread) {
        super(jThread);
    }

    @Override
    public void execute(InstructionType instructionType) {

        switch (instructionType) {
            case IFNULL: {
                JObject ref = popOperandStackRefVal();
                if (ref == null) {
                    offerIncrement(parseAndReadValU2(false));
                } else {
                    parseAndReadValU2();
                }
                break;
            }
            case IFNONNULL: {
                JObject ref = popOperandStackRefVal();
                if (ref != null) {
                    offerIncrement(parseAndReadValU2(false));
                } else {
                    parseAndReadValU2();
                }
                break;
            }
            case GOTO_W: {
                break;
            }
            case JSR_W: {
                break;
            }
        }
    }
}
